package main.java.indi.zyj.sword;

public class MaxSales {

    public int maxSales(int[] sales) {

        if (sales.length == 0) {
            return 0;
        }

        int[] dp = new int[sales.length];
        dp[0] = sales[0];
        int res = sales[0];

        for (int i = 1; i < dp.length; i++) {
            dp[i] = Math.max(sales[i], sales[i] + dp[i - 1]);
            res = Math.max(res, dp[i]);
        }

        return res;

    }


}
